/*
 * ButtonList.cpp
 *
 *  Created on: 15.05.2009
 *      Author: h3llfire
 */

#include "ButtonList.h"

namespace Impp {

/*
 * ButtonDefination
 */
ButtonDefination::ButtonDefination(int id, const wxString & title, const wxString & description) :
	id(id),
	title(title),
	description(description){};

/*
 * NormalButtonDefination
 */
ActionButtonDefination::ActionButtonDefination(int id, const wxString & title, const wxString & description, const wxString & moduleName, const wxString & actionName) :
	ButtonDefination(id, title, description),
	moduleName(moduleName),
	actionName(actionName){};

/*
 *  CheckSettingButtonDefination
 */
CheckSettingButtonDefination::CheckSettingButtonDefination(int id, const wxString & title, const wxString & description, const DBModule module, const wxString & settingName) :
	ButtonDefination(id, title, description),
	module(module),
	settingName(settingName){};

/*
 * ButtonList
 */
ButtonList::ButtonList(int firstId) :
	nextId(firstId)
{
}

ButtonList::~ButtonList()
{
	std::vector<ButtonDefination*>::iterator b;
	for(b = buttons.begin(); b != buttons.end(); b++){
		delete *b;
	}
}

void ButtonList::addActionButton(const wxString & moduleName, const wxString & actionName, const wxString & title, const wxString & description)
{
	ActionButtonDefination* button = new ActionButtonDefination(nextId++, title, description, moduleName, actionName);
	buttons.push_back(button);
}

void ButtonList::addCheckSettingButton(DBModule & dbModule, const wxString & settingName, const wxString & title, const wxString & description){
	CheckSettingButtonDefination* button = new CheckSettingButtonDefination(nextId++, title, description, dbModule, settingName);
	buttons.push_back(button);
}

std::vector<ButtonDefination*> ButtonList::getButtons()
{
	return buttons;
}
}
